﻿using System;
using System.Collections.Generic;
using System.Text;

namespace GTTSOfLibrary.MyException
{
    /// <summary>
    /// 定义磁盘满的异常类（用于测试）
    /// <example>
    /// 如果没有额外的数据要包含到类中，可以简单地写：
    /// <code>
    /// //定义一个磁盘满的异常类
    /// [Serializable]
    /// public sealed class DiskFullExceptionArgs : ExceptionArgs { }
    /// </code>
    /// </example>
    /// </summary>
    [Serializable]
    public sealed class DiskFullExceptionArgs : ExceptionArgs
    {
        //readonly:只读，动态常量，只能在构造器中被赋值
        private readonly String m_diskpath;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="diskpath"></param>
        public DiskFullExceptionArgs(String diskpath)
        {
            m_diskpath = diskpath;
        }

        /// <summary>
        /// 磁盘地址
        /// </summary>
        public String DiskPath
        {
            get
            {
                return m_diskpath;
            }
        }

        /// <summary>
        /// 信息
        /// </summary>
        public override string Message
        {
            get
            {
                return (m_diskpath == null) ? base.Message : "DiskPath=" + m_diskpath;
            }
        }
    }
}
